<%--
  Created by IntelliJ IDEA.
  User: 86175
  Date: 2023/5/16
  Time: 16:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script>
        var inputs = document.getElementsByTagName("input")
        window.onload = function () {
            for (var i = 0; i < inputs.length; i++) {
                if (localStorage.getItem(inputs[i].name) !== null) {
                    inputs[i].value = localStorage.getItem(inputs[i].name)
                }
            }
        }

        function setLocalStorage() {
            for (var i = 0; i < inputs.length; i++) {
                localStorage.setItem(inputs[i].name, inputs[i].value)
            }
        }
    </script>
    <link href="https://cdn.bootcdn.net/ajax/libs/bootstrap/5.2.3/css/bootstrap.css" rel="stylesheet">
</head>
<body>
<form style="width: 40%;margin: auto;margin-top: 100px" method="post" action="ConnectionServlet">
    <div class="container mt-5">
        <div class="row mb-3">
            <div class="input-group mb-3">
                <span class="input-group-text">mysql://</span>
                <input type="text" class="form-control" name="url" placeholder="url" aria-label="url">
                <span class="input-group-text">:</span>
                <input type="text" class="form-control" name="port" placeholder="port" aria-label="port">
                <span class="input-group-text">/</span>
                <input type="text" class="form-control" name="db" placeholder="db" aria-label="db">
            </div>
        </div>
        <div class="row">
            <div>
                <label for="username" class="form-label">用户名</label>
                <input type="text" name="username" id="username" class="form-control" required>
            </div>
            <div>
                <label for="password" class="form-label">密码</label>
                <input type="password" name="password" id="password" class="form-control" required>
            </div>
        </div>
        <div class="d-grid gap-2" style="width: 100%;text-align: center;margin-top: 50px">
            <button type="submit" class="btn btn-primary ">登录</button>
        </div>

    </div>
</form>
</body>
</html>
